(function () {
 var nickname =  document.querySelector("#nickname")
 var btn =  document.querySelector("#enter")
  btn.addEventListener("click", function (e) { 
    console.log(nickname.value.trim());
    if (nickname != '') {
      localStorage.setItem("nickname", nickname.value.trim())
      location.href = 'index.html'
    } else {
      alert("请输入昵称")
    }
  })
})()